package com.xuenci.gulimall.auth;/*
 *@author:xec
 *@date:2022/5/20  16:27
 */

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * SpringSession的核心原理
 *
 * 1. EnableRedisHttpSession导入RedisHttpSessionConfiguration配置
 *    - 给容器添加一个组件
 *      - SessionRepository ==> [RedisOperationsSessionRepository] ==> redis操作session，session的增删改查封装类
 *    - SessionRepositoryFilter==》Filterr：session存储过滤器：每个请求过来都要进过Filter
 *      - 创建的时候，就自动从容器汇总获取到了SessionRepository；
 *      - 原始的request和response都被包装，SessionRepository[Request]Wrapper、SessionRepository[Response]Wrapper
 *      - 以后获取session，都用request.getSession();
 *      - wrappedRequest.getSession();===> SessionRepository中获取到的
 *    装饰者模式
 *    自动延期；redis的数据也是有过期时间的
 */

@EnableRedisHttpSession   // 整合redis作为session存储
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class GulimallAuthServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallAuthServerApplication.class,args);
    }
}
